package com.community.auth.config;

import org.springframework.amqp.core.Binding;
import org.springframework.amqp.core.DirectExchange;
import org.springframework.amqp.core.Exchange;
import org.springframework.amqp.core.Queue;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.HashMap;
import java.util.Map;

@Configuration
public class RabbitMqConfig {



    /**
     * 创建队列
     * @return
     */
    @Bean
    public Queue createSmsQueue() {
        return new Queue("send_sms");
    }

    /**
     * 创建交换机
     * @return
     */
    @Bean
    public Exchange createExchange() {
        DirectExchange directExchange = new DirectExchange("community.direct");
        return directExchange;
    }

    /**
     * 绑定
     * @return
     */
    @Bean
    public Binding createBinding() {
        return new Binding("send_sms",Binding.DestinationType.QUEUE,
                "community.direct","send.sms",null);
    }


}
